﻿<{include file="header.htm"}>
     <link href="<{$config.weburl}>/templates/default/css/space.css?t=<{$now_time}>" rel="stylesheet" media="screen" type="text/css" />
        <!-- 中间内容开始 -->
        <div class="bigauto">
            <div class="width_1000">
                <!--登陆开始-->
                <div class="user_space_big">
                    <div class="login_con">
                        <div class="free_enr"><a href="javascript:void(0);">手机验证</a></div>
                        <div class="login_rig_con" style=" margin-top: 50px;">
                            <form action="oauth.php" onsubmit="return check_data();" method="post" enctype="multipart/form-data">
                                <input type="hidden" name="action" value="mobile_submit"/>
                                <input type="hidden" name="connect_id" value="<{$connect_id}>" />
                                <table width="350" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td height="30"><span class="title">手机号</span></td>
                                    </tr>

                                    <tr>
                                        <td height="50"><input type="text" name="mobile" id="mobile" class="login_yzm" style=" width: 330px;" placeholder="请输入手机号" /></td>
                                    </tr>

                                    <tr>
                                        <td height="30"><span class="title">短信验证码</span></td>
                                    </tr>

                                    <tr>
                                        <td height="50" ><input type="text" name="code" placeholder="请输入短信验证码" id="code" style=" width: 230px;" class="login_yzm">
                                            <span style=" display: block; float: left; width: 90px; height: 35px; line-height: 35px; text-align: center; background:#e77817; color: #fff; font-size: 14px; margin-left: 5px; cursor: pointer;" id="sendCode">点击发送</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td height="50"><input type="submit" style=" height: 35px; line-height: 35px;" value="立即验证" class="login_btn" /></td>
                                    </tr>
                                </table>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <!--登陆结束-->
        </div>
        <script type="application/javascript">

            function  check_data(){
                var mobile = $("#mobile").val();
                var code = $("#code").val();
                var mobile_part = /^1\d{10}$/;
                if(mobile == ''){
                    alert("请填写手机号");
                    return false;
                } else if(!mobile_part.test(mobile)){
                    alert("请填写正确的手机号");
                    return false;
                } else if(code == '' ){
                    alert("请填写短信验证码");
                    return false;
                } else {
                    return true;
                }

            }

            function settime(val) {
                if (val == 0) {
                    $("#sendCode").removeClass("on");
                    $("#sendCode").html("点击发送");
                    return false;
                } else {
                    if(val == ''){
                        val = 60;
                    }
                    $("#sendCode").html("重新发送" + val + 's');
                    val--;
                    $("#sendCode").addClass("on");
                }
                setTimeout(function() {
                    settime(val)
                },1000)
            }

            //发送短信
            $("#sendCode").on("click",function(){
                var mobile = $("#mobile").val();
                var mobile_part = /^1\d{10}$/;
                if(mobile == ''){
                    alert("请填写手机号");
                    return false;
                } else if(!mobile_part.test(mobile)){
                    alert("请填写正确的手机号");
                    return false;
                } else {
                    if($(this).hasClass("on")){
                        return false;
                    }
                    $.post("ajax_back_end.php",{action:'sendSms',mobile:mobile},function(ret){
                        ret = eval('('+ret+')');
                        if(!ret.status){
                            alert(ret.msg);
                        } else {
                            settime(60);
                        }
                    });
                }
            });

        </script>
<{include file="footer.htm"}>